<template>
<el-card class="box-card">
    <div slot="header" class="clearfix">
    <h1 class="container-title fl">货物类型信息</h1>
    <a href="/adduser" class="btn-add fr disabled-for-normal">添加用户</a>
     </div>
    <el-table
    :data="tableData"
    stripe
    style="width: 100%">
    <el-table-column
      prop="goodname"
      label="名称"
      width="180">
    </el-table-column>
    <el-table-column
      prop="name"
      label="设备类型"
      width="180">
    </el-table-column>
    <el-table-column
      prop="des"
      label="描述"
      width="180">
    </el-table-column>
    <el-table-column
      prop="create_time"
      label="创建时间"
      width="180">
    </el-table-column>
    <el-table-column
      prop="updated"
      label="更新时间"
      width="180">
    </el-table-column>
       <el-table-column
      fixed="right"
      label="操作"
      width="100">
      <template slot-scope="scope">
        <el-button type="text" size="small" @click="upclick(scope.row)">编辑</el-button>
        <el-button @click="handleClick(scope.row)" type="text" size="small">删除</el-button>
        
      </template>
    </el-table-column>
  </el-table>
  
  


</el-card>
</template>
    
    <script>
    import {showu,del,upone,showgt,delgt} from '../api/api'
        export default {
    
            data(){
                return {
                    msg:'你好，这里是首页',
                    name:'',
                    tableData:[],
                   
                    
                }
            },
            //定义组建标签
            components:{
            },
            filters: {
     
　　},
            //自定义方法
            methods:{
                   show_gt(){
                  showgt().then( res => {
                  this.tableData=res
         
              })
    
          },
          handleClick:function(reg){
            console.log(reg)
            var id=reg['id']
            var params={'id':id}
             delgt(params).then( res => {
                  this.$Message(res.message)
         
              })
            
          },
          upclick:function(reg){
            var id=reg['id']
            this.$router.push({ name: 'Uptype', params: { value: id }})
          }
    
            },
            //钩子方法
            mounted:function(){
              this.show_gt();
    

      
    
            },
            //监听属性
            watch:{
    
    
            },
            //计算属性
            computed:{
    
    
            }
    
    
    
        }
    
    
    </script>
    
    <style>
    .box-card{
        
         height:600px;

    }
    
  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  .clearfix:after {
    clear: both
  }
  .container-title {
    font-size: 20px;
    line-height: 32px;
    font-weight: normal;
    color: #39486c;
  }
  .fl {
    float: left;
  }
  .btn-add {
    display: inline-block;
    width: 100px;
    height: 32px;
    font-weight: normal;
    font-size: 12px;
    line-height: 32px;
    border-radius: 3px;
    color: #fff;
    text-indent: 36px;
    background: #547edf url(http://lilly.zenm.vip/images/icon-add-btn.png) 16px center no-repeat;
}
.fr {
    float: right;
}
a {
    text-decoration: none;
}
.iot-table {
    width: 100%;
    font-size: 11px;
    color: #39486c;
    line-height: 48px;
}
table {
    background-color: transparent;
    border-spacing: 0;
    border-collapse: collapse;
    
}

thead{
    display: table-header-group;
    vertical-align: middle;
    border-color: inherit;
}
tr {
    display: table-row;
    vertical-align: inherit;
    border-color: inherit;
}
    </style>
